using Prism.Ioc;
using Prism.Modularity;
using Prism.Unity;
using PrismDemo.Views;
using System.Windows;
using UserManagement;
using ProductManagement;

namespace PrismDemo
{
    // App.xaml 的交互逻辑
    // 注册代码当然也可以在启动项目App.xaml.cs中的RegisterTypes重写函数中实现。
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 注册视图
            containerRegistry.RegisterForNavigation<Views.WelcomeView>();
            // 注册对话框
            containerRegistry.RegisterDialog<Views.Dialogs.ConfirmationDialog, ViewModels.Dialogs.ConfirmationDialogViewModel>();
            containerRegistry.RegisterDialog<Views.Dialogs.NotificationDialog, ViewModels.Dialogs.NotificationDialogViewModel>();
        }

        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            // 注册模块
            moduleCatalog.AddModule<UserManagementModule>();
            moduleCatalog.AddModule<ProductManagementModule>();
        }
    }
}